/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dto;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import java.util.ResourceBundle;

/**
 * Metadata of an track
 * 
 * @author Sebastian
 */
@DatabaseTable(tableName = "track_metadata")
public class Metadata {
    
    public enum RATING { LOW, MEDIUM, HIGH }
    
    public static final String TRACK_TABLE_NAME = "track";
    private static final String DISTANCE_TABLE_NAME = "distance";
    private static final String TIME_TABLE_NAME = "time";
    private static final String PROFILE_TABLE_NAME = "profile";
    private static final String HOTELS_TABLE_NAME = "hotels";
    private static final String DESCRIPTION_TABLE_NAME = "description";
    private static final String WEATHER_TABLE_NAME = "weather";
    private static final String DOGS_TABLE_NAME = "suitable_for_dogs";
    private static final String GROUND_CON_TABLE_NAME = "ground_conditions";
    private static final String POI_TABLE_NAME = "poi";
    private static final String HOME_DIST_TABLE_NAME = "home_distance";
    private static final String BUSTLE_TABLE_NAME = "bustle";
    private static final String PARKING_TABLE_NAME = "parking";
    private static final String RATING_TABLE_NAME = "rating";
    private static final String RESTING_PLACES_TABLE_NAME = "resting_places";
    private static final String RESTAURANTS_TABLE_NAME = "restaurants";
    private static final String RESTING_OPTIONS_TABLE_NAME = "resting_options";
    private static final String SIGNS_TABLE_NAME = "signs";
    private static final String EXPENSES_TABLE_NAME = "expenses";
    private static final String TEMPERATURE_TABLE_NAME = "temperature";
    
    @DatabaseField(generatedId = true)
    private int id;
    
    @DatabaseField(columnName = DISTANCE_TABLE_NAME)
    private float   distance; // Streckenlaenge in km
    @DatabaseField(columnName = TIME_TABLE_NAME)
    private long     time; // Gehzeit / Gesamtzeit
    @DatabaseField(columnName = PROFILE_TABLE_NAME)
    private String  profile; // Streckenprofil (flach, viele Steigungen, ...)
    @DatabaseField(columnName = HOTELS_TABLE_NAME)
    private String  hotels; // Einkehrmoeglichkeiten (Hotels usw.)
    @DatabaseField(columnName = DESCRIPTION_TABLE_NAME)
    private String  description; // Streckenbeschreibung
    @DatabaseField(columnName = WEATHER_TABLE_NAME)
    private String  weather; // Wetter / Temperatur
    @DatabaseField(columnName = DOGS_TABLE_NAME)
    private boolean suitableForDogs; // Für Hunde geeignet
    @DatabaseField(columnName = GROUND_CON_TABLE_NAME)
    private String  groundConditions; // Bodenverhaeltnisse
    @DatabaseField(columnName = POI_TABLE_NAME)
    private String  placesOfInterest; // Sehenswuerdigkeiten
    @DatabaseField(columnName = HOME_DIST_TABLE_NAME)
    private float     distanceToHome; // Entfernung von Heimatort zu Startpunkt
    @DatabaseField(columnName = BUSTLE_TABLE_NAME)
    private String  bustle; // Betrieb auf der Strecke (wie viele Leute)
    @DatabaseField(columnName = PARKING_TABLE_NAME)
    private String  parking; // Parkmoeglichkeiten an Start und Ziel
    @DatabaseField(columnName = RATING_TABLE_NAME)
    private RATING  rating; // Streckenbewertung
    @DatabaseField(columnName = RESTING_PLACES_TABLE_NAME)
    private String  restingPlaces; // Rastplaetze
    @DatabaseField(columnName = RESTAURANTS_TABLE_NAME)
    private String  restaurants; // Restaurants
    @DatabaseField(columnName = RESTING_OPTIONS_TABLE_NAME)
    private boolean  restingOptions; // Gute Pausenmoeglichkeiten
    @DatabaseField(columnName = SIGNS_TABLE_NAME)
    private String  signs; // Wegweiser / Beschilderungen
    @DatabaseField(columnName = EXPENSES_TABLE_NAME)
    private float   expenses; // Kosten
    @DatabaseField(columnName = TEMPERATURE_TABLE_NAME)
    private float   temperature; // Kosten
    
    @DatabaseField(foreign = true, columnName = TRACK_TABLE_NAME)
    private Track   parent;
    
    private static final String DISTANCE = "distancelessnull";
    private static final String DISTANCETOHOME = "distancehomelessnull";
    
    
    public Metadata(
            float distance, 
            long time,
            String profile,
            String hotels,
            String description,
            String weather,
            boolean suitableForDogs,
            String groundConditions,
            String placesOfInterest,
            float distanceToHome,
            String bustle,
            String parking,
            RATING rating,
            String restingPlaces,
            String restaurants,
            boolean restingOptions,
            String signs,
            float expenses,
            float temperature) {
        
        setDistance(distance);
        setTime(time);
        setProfile(profile);
        setHotels(hotels);
        setDescription(description);
        setWeather(weather);
        setSuitableForDogs(suitableForDogs);
        setGroundConditions(groundConditions);
        setPlacesOfInterest(placesOfInterest);
        setDistanceToHome(distanceToHome);
        setBustle(bustle);
        setParking(parking);
        setRating(rating);
        setRestingPlaces(restingPlaces);
        setRestaurants(restaurants);
        setRestingOptions(restingOptions);
        setSigns(signs);
        setExpenses(expenses);
        setTemperature(temperature);
    }
    
    public Metadata() {};

    public float getDistance() {
        return distance;
    }

    public void setDistance(float distance) {
        if (distance < 0.0) throw new IllegalArgumentException(ResourceBundle.getBundle("gui/guilabels").getString(DISTANCE));
        this.distance = distance;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public String getProfile() {
        return profile;
    }

    public void setProfile(String profile) {
        this.profile = profile;
    }

    public String getHotels() {
        return hotels;
    }

    public void setHotels(String hotels) {
        this.hotels = hotels;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getWeather() {
        return weather;
    }

    public void setWeather(String weather) {
        this.weather = weather;
    }

    public boolean isSuitableForDogs() {
        return suitableForDogs;
    }

    public void setSuitableForDogs(boolean suitableForDogs) {
        this.suitableForDogs = suitableForDogs;
    }

    public String getGroundConditions() {
        return groundConditions;
    }

    public void setGroundConditions(String groundConditions) {
        this.groundConditions = groundConditions;
    }

    public String getPlacesOfInterest() {
        return placesOfInterest;
    }

    public void setPlacesOfInterest(String placesOfInterest) {
        this.placesOfInterest = placesOfInterest;
    }

    public float getDistanceToHome() {
        return distanceToHome;
    }

    public void setDistanceToHome(float distanceToHome) {
        if (distanceToHome < 0) throw new IllegalArgumentException(ResourceBundle.getBundle("gui/guilabels").getString(DISTANCETOHOME));
        this.distanceToHome = distanceToHome;
    }

    public String getBustle() {
        return bustle;
    }

    public void setBustle(String bustle) {
        this.bustle = bustle;
    }

    public String getParking() {
        return parking;
    }

    public void setParking(String parking) {
        this.parking = parking;
    }

    public RATING getRating() {
        return rating;
    }

    public void setRating(RATING rating) {
        this.rating = rating;
    }

    public String getRestingPlaces() {
        return restingPlaces;
    }

    public void setRestingPlaces(String restingPlaces) {
        this.restingPlaces = restingPlaces;
    }

    public String getRestaurants() {
        return restaurants;
    }

    public void setRestaurants(String restaurants) {
        this.restaurants = restaurants;
    }

    public boolean getRestingOptions() {
        return restingOptions;
    }

    public void setRestingOptions(boolean restingOptions) {
        this.restingOptions = restingOptions;
    }

    public String getSigns() {
        return signs;
    }

    public void setSigns(String signs) {
        this.signs = signs;
    }

    public float getExpenses() {
        return expenses;
    }

    public void setExpenses(float expenses) {
        this.expenses = expenses;
    }
    
    public void setParentTrack(Track track) {
        this.parent = track;
    }
    
    public float getTemperature() {
        return temperature;
    }

    public void setTemperature(float temperature) {
        this.temperature = temperature;
    }
    
    public Track getParent() {
        return parent;
    }

    public void setParent(Track parent) {
        this.parent = parent;
    }
    
}
